<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<script src="${ctx}/js/lib/echart/echarts.js" type="text/javascript"></script>
<script src="${ctx}/js/controllers/HomeController.js" type="text/javascript"></script>
	<style>
		.home_logo{
			width: 135px; 
			height: 121px; 
			margin-top:32px;
			margin-left:43px;
		}
		.npta{
			margin-left:18px;
			margin-right:19px;
		}
		.left_pic{
			margin-left:25px;
			margin-top:30px;
			cursor:pointer;
		}
		.rightUp_pic{
			margin-left:52px;
			margin-top:31px;
			margin-right:34px;
			float:left;
		}
		.botton-sty{
			width:72px;
			height:23px;
			border-radius:18px;
			font-size: 14px;
			background-color: #fff;
			border: 1px solid ;
		}
		.picture-sty{
			margin-right:11px;
			float:left;
			width:55px;
			height:55px;
			border:1px solid #DEDEDE;
		}
	</style>
</head>
<body>
	<div style="margin-left:4px;top:130px;position:absolute;height:30px;line-height:30px;font-size: 14px; font-family: '微软雅黑';">
		当前位置：${sessionScope.currcent_position}
	</div>
	<div style="/* width:99.8%; */margin-top:140px;border:1px solid #DCDCDC;font-family: '微软雅黑';overflow: auto;">
		<!-- 店铺基本信息及操作（左边） -->
		<div style="width:229px;float:left;">
			<div>
				<c:if test="${shopInfo.logo == null || shopInfo.logo == ''}">
					<img id="home_logo" class="home_logo" src="${ctx}/images/seller/home/default_shop.jpg" />
				</c:if>
				<c:if test="${shopInfo.logo != null && shopInfo.logo != ''}">
					<img id="home_logo" class="home_logo" src="${sessionScope.image_logo}${shopInfo.logo}" />
				</c:if>
			</div>
			<div style="margin-top:49px;">
				<img id="name" class="npta" src="${ctx}/images/seller/home/name.png" />
				<span>${shopInfo.name}</span>
			</div>
			<div style="margin-top:21px;">
				<img id="phone" class="npta" src="${ctx}/images/seller/home/phone.png" />
				<span>${shopInfo.phone}</span>
			</div>
			<div style="margin-top:21px;">
				<img id="time" class="npta" src="${ctx}/images/seller/home/time.png" />
				<span>
					<fmt:formatDate value="${shopInfo.beginTime}" pattern="HH:mm"/>-<fmt:formatDate value="${shopInfo.endTime}" pattern="HH:mm"/>
				</span>
			</div>
			<div style="margin-top:21px;">
				<img id="addr" class="npta" src="${ctx}/images/seller/home/addr.png" />
				<span>店铺地址</span><br>
				<div style="width:65%; margin-left:60px;">
					<span style="line-height:150%">${shopInfo.address}</span>
				</div>
			</div>
			<div style="margin-top:60px;">
				<!-- 暂停营业状态 -->
				<input id="state" type="hidden" value="${shopInfo.state }">
				<c:if test="${shopInfo.state == 4}">
					<div id="suspend" style="background-image:url('${ctx}/images/seller/home/shopState.png');width:179px;height:46px;" class="left_pic" onclick="shopStateChange('${shopInfo.id}','${shopInfo.state}')" >
						<div style="position:absolute;z-index:2;padding-left: 74px;padding-top: 11px;font-size:18px;color:#FAFCFD;">
							开始营业
						</div>
					</div>
				</c:if>
				<!-- 正常营业状态 -->
				<c:if test="${shopInfo.state == 2}">
					<div id="suspend" style="background-image:url('${ctx}/images/seller/home/shopState.png');width:179px;height:46px;" class="left_pic" onclick="shopStateChange('${shopInfo.id}','${shopInfo.state}')" >
						<div style="position:absolute;z-index:2;padding-left: 74px;padding-top: 11px;font-size:18px;color:#FAFCFD;">
							暂停营业
						</div>
					</div>
				</c:if>
				<%-- <img id="addProduct" class="left_pic" onclick="addGoods()" src="${ctx}/images/home/addProduct.png" /> --%>
				<a onclick="homePageShowOrder(100146355164006600,100146485669408300 , '/goods/editGoodsInfo')">
  					<img id="addProduct" class="left_pic" src="${ctx}/images/seller/home/addProduct.png" />
  				</a>
				
				<a href="#">
					<img id="config" class="left_pic" src="${ctx}/images/seller/home/config.png"  onclick="homePageShowOrder('100146457474979700',100146457481726600 , '/storeInfo/storeInfoList');"/>
				</a>
			</div>
		</div>
		<!-- 预览（右边） -->
		<div style="float:left;width:967px;border-left:1px solid #DCDCDC;">
			<!-- 订单统计（右上） -->
			<div style="height:153px;" ><!-- onclick="clickFirstMenu(100146466641769300);" -->
				<img id="one" class="rightUp_pic" style="margin-left:26px;cursor: pointer;" src="${ctx}/images/seller/home/one.png"  onclick="homePageShowOrder('100146466641769300','100146475031391100' , '/order/orderList?state=0');"/>
				<div style="margin-top:46px;float:left;cursor: pointer;" onclick="homePageShowOrder('100146466641769300','100146475031391100' , '/order/orderList?state=0');">
					<div style="font-size: 18px; color: #262535;">待付款订单</div>
					<div style="font-size: 14px; color: #919191; text-align: center;margin-top:16px">${fn:length(waitPayMoneyOrderList)}</div>
				</div>
				<img id="two" class="rightUp_pic" style="cursor: pointer;" src="${ctx}/images/seller/home/two.png"  onclick="homePageShowOrder('100146466641769300','100146475044046500 ' , '/order/orderList?state=1');"/>
				<div style="margin-top:46px; float:left;cursor: pointer;" onclick="homePageShowOrder('100146466641769300','100146475044046500 ' , '/order/orderList?stateType=3');">
					<div style="font-size: 18px; color: #262535;">待确认订单</div>
					<div style="font-size: 14px; color: #919191; text-align: center;margin-top:16px">${fn:length(waitComfirmOrderList)}</div>
				</div>
				<img id="there" class="rightUp_pic" style="cursor: pointer;"  src="${ctx}/images/seller/home/there.png"  onclick="homePageShowOrder('100146466641769300','100146475056619800 ' , '/order/orderList?state=2');"/>
				<div style="margin-top:46px; float:left;cursor: pointer;" onclick="homePageShowOrder('100146466641769300','100146475056619800 ' , '/order/orderList?state=2');">
					<div style="font-size: 18px; color: #262535;">待发货订单</div>
					<div style="font-size: 14px; color: #919191; text-align: center;margin-top:16px">${fn:length(waitSendOrderList)}</div>
				</div>
				<img id="four" class="rightUp_pic"  style="cursor: pointer;" src="${ctx}/images/seller/home/four.png" onclick="homePageShowOrder('100146466641769300','100146475124816700  ' , '/order/orderList?stateType=1');" />
				<div style="margin-top:46px; float:left;cursor: pointer;" onclick="homePageShowOrder('100146466641769300','100146475124816700  ' , '/order/orderList?stateType=1');">
					<div style="font-size: 18px; color: #262535;">退款订单</div>
					<div style="font-size: 14px; color: #919191; text-align: center;margin-top:16px">${fn:length(waitRefundOrderList)}</div>
				</div>
			</div>
			<!-- 详情（右下） -->
			<div >
				<!-- 右下中 -->
				<div style="float:left;width:72%;margin-left:20px;">
					<!-- 订单报表 -->
					<div style="cursor: pointer;">
						<img id="orderReport" style="width:100%;"  onclick="clickFirstMenu(100146466649329800);" src="${ctx}/images/seller/home/orderReport.png" />
						<div style="width:600px;height:420px;margin-left: 40px;top:-30px;" id="echartsShow">
                        <%-- <img src="${ctx }/images/seller/home/temp.png" /> --%>
                      </div>
					</div>
					<!-- 待处理订单 -->
					<div  >
						<img id="untreated" style="width:100%;cursor: pointer;" src="${ctx}/images/seller/home/untreated.png"  onclick="clickFirstMenu(100146466641769300);"/>
						<div style="background-color:#FCFCFC;">
							<div style="padding-left:26px;padding-bottom:76px;">
								<!-- 单个 -->
						   <c:if test="${not empty orderInfos}">
                            <c:forEach items="${orderInfos}" var="order" varStatus="status">
								<div style="height:100px;padding-top:10px;color: #7B7776;font-size: 14px;">
									
									<div style="font-size:14px;">
										<img id="envelope" style="float:left;margin-top:2px;" src="${ctx}/images/seller/home/envelope.png" />
										<div style="margin-left:20px;float:left;">
										<c:if test="${order.state == 1}">待确认订单</c:if>
										<c:if test="${order.state == 2}">待发货订单</c:if>
                                        <c:if test="${order.state == 6}">待退款订单</c:if>
                                        <c:if test="${order.state == 10}">待退货订单</c:if>
										（总价${order.totalPrice }元）</div>
										<div style="float:right;margin-right:20px;">
											<fmt:formatDate value="${order.createTime}" pattern="yyyy/MM/dd"/>&nbsp;&nbsp;&nbsp;&nbsp;
											<fmt:formatDate value="${order.createTime}" pattern="HH : mm"/>
										</div>
									</div>
									<!-- 超过四张图的待发货订单 -->
									<div style="margin-top:30px;">
										<!-- 四张 -->
										<%-- <div style="float:left;">
											<img id="pic" class="picture-sty" src="${ctx}/images/seller/home/one.png" />
											<img id="pic" class="picture-sty" src="${ctx}/images/seller/home/one.png" />
											<img id="pic" class="picture-sty" src="${ctx}/images/seller/home/one.png" />
											<img id="pic" class="picture-sty" src="${ctx}/images/seller/home/one.png" />
											<div style="margin-left:5px;margin-top:15px;text-align:center;float:left;">...</div>
											<div style="margin-left: 350px;padding-top: 35px;">销量x20份</div>
										</div> --%>
										<!-- 三张 -->
										<div style="float:left;">
										<c:forEach items="${order.orderDetails }" var="orderDetail" varStatus="status">
										<c:if test="${orderDetail.goodsLogo != null}">
											<img id="pic" class="picture-sty" src="${sessionScope.image_logo}${orderDetail.goodsLogo }" />
										</c:if>
										<c:if test="${orderDetail.goodsLogo == null}">
											<img id="pic" class="picture-sty" src="${ctx}/images/seller/common/defaultgoods.jpg" />
										</c:if>
										</c:forEach>
										</div>
										<!-- 待确认订单按钮 -->
										<c:if test="${order.state == 1 && order.isNeedConfirm == 1}">
										<div style="float:right;margin-right:12px;margin-top:15px;">
											<button class="botton-sty" style="color:#7B7776;cursor: pointer;" onclick="changeState('${order.id}','${order.state}',3);">拒绝</button>
										</div> 
										<div style="float:right;margin-right:15px;margin-top:15px;">
										<!--点击确认，如果商品是配送那一类，不自提，跳转待发货  -->
										<c:if test="${order.distributionType == 1 && order.isBySelf == 0}">
										<button class="botton-sty" style="color:#F8A20F;cursor: pointer;" onclick="changeState('${order.id}','${order.state}',1);">确认</button>
										</c:if>
										<!--点击确认，如果商品是配送那一类并且自提，或者商品不是配送那一类，都跳转待消费  -->
										<c:if test="${(order.distributionType == 1 && order.isBySelf == 1) || order.distributionType == 0}">
										<button class="botton-sty" style="color:#F8A20F;cursor: pointer;" onclick="changeState('${order.id}','${order.state}',2);">确认</button>
										</c:if>
										</div>
										</c:if>
										<!-- 待发货订单按钮 -->
										<c:if test="${order.state == 2}">
										<div style="float:right;margin-right:98px;margin-top:15px;">
										<!--点击发货，跳转待收货订单（3）  -->
											<button class="botton-sty" style="color:#F8A20F;cursor: pointer;" onclick="changeState('${order.id}','${order.state}');">发货</button>
										</div> 
										</c:if>
										<!-- 退款申请 -->
										<c:if test="${order.state == 6}">
										<div style="float:right;margin-right:12px;margin-top:15px;">
                                        <!--点击拒绝，跳转待确认（1）  -->
                                            <button class="botton-sty" style="color:#7B7776;cursor: pointer;" onclick="changeState('${order.id}','${order.state}',5);">拒绝</button>
                                        </div> 
                                        <div style="float:right;margin-right:15px;margin-top:15px;">
                                         <!--点击同意，跳转待退款订单（7）  -->
                                            <button class="botton-sty" style="color:#F8A20F;cursor: pointer;" onclick="changeState('${order.id}','${order.state}',4);">同意</button>
                                        </div> 
										</c:if>
										<!-- 退货申请 -->
                                        <c:if test="${order.state == 10}">
                                       <div style="float:right;margin-right:15px;margin-top:15px;">
                                       <!--点击拒绝，跳转已完成订单（4）  -->
                                            <button class="botton-sty" style="color:#7B7776;cursor: pointer;" onclick="changeState('${order.id}','${order.state}',7);">拒绝</button>
                                        </div> 
                                        <div style="float:right;margin-right:15px;margin-top:15px;">
                                        <!--点击同意，跳转退货已确认（11）  -->
                                            <button class="botton-sty" style="color:#F8A20F;cursor: pointer;" onclick="changeState('${order.id}','${order.state}',6);">同意</button>
                                        </div> 
                                        </c:if>
									</div>
									<div style="margin-top: 100px;">
										<hr style="border: 1px dashed #E6E6E6;width: 100%;">
									</div>
								</div>
                            </c:forEach>
                            </c:if>
							</div>
						</div>
					</div>
				</div>
				<!-- 右下右 -->
				<div style="margin-left:18px;float:left;width:24%">
					<!-- 通知 -->
					<div>
						<img id="notice" style="width:100%;cursor:pointer" src="${ctx}/images/seller/home/notice.png" onclick="clickFirstMenu(100146355167505400);">
						<div style="background-color:#FCFCFC;">
							<div style="margin-left:27px;margin-bottom:15px;" >
								<div style="padding-bottom:34px;">
									<c:forEach items="${noticeInfos}" var="noticeInfo" varStatus="noticeInfoStatus">
										<div style="cursor:pointer;height:65px;color: #7B7776;" 
										onclick="homePageShowDetail(100146355167505400,100146407085782600 , '/noticeInfo/noticeInfoList',${noticeInfo.id})">
											<div style="font-size: 14px;padding-top:12px;">
												<div style="float:left;font-size: 12px;margin-top:2px;"><</div>
												<div style="margin-left: 25px;">${fn:substring(noticeInfo.title , 0 , 10)}<c:if test="${fn:length(noticeInfo.title) > 10}">...</c:if></div>
											</div>
											<div style="margin-left: 25px;margin-top:8px;font-size: 12px;">
												<fmt:formatDate value="${noticeInfo.updateTime}" pattern="yyyy/MM/dd"/>&nbsp;&nbsp;&nbsp;&nbsp;
												<fmt:formatDate value="${noticeInfo.updateTime}" pattern="HH : mm"/>
											</div>
											<div style="margin-top: 9px;">
												<hr style="border: 1px dashed #E6E6E6;width: 100%;margin:0 auto;">
											</div>
										</div>
									</c:forEach>
								</div>
							</div>
						</div>
					</div>
					<!-- 店内热销商品 -->
					<div>
						<img id="selling" style="width:100%;" src="${ctx}/images/seller/home/selling.png" />
						<div style="background-color:#FCFCFC;height:500px;padding-top:11px;">
							<c:forEach items="${goodsInfos}" var="goodsInfo" varStatus="goodsInfoStatus">
								<div style="height:89px;cursor:pointer;" onclick="clickFirstMenu(100146355164006600);">
									<div style="padding-top:11px;">
										<div style="float:left;margin-left:19px;">
											<c:if test="${goodsInfo.logo == null || goodsInfo.logo == ''}">
												<img id="goodLogo" style="width:70px;height:70px;" src="${ctx}/images/seller/home/default_goods.jpg" />
											</c:if>
											<c:if test="${goodsInfo.logo != null && goodsInfo.logo != ''}">
												<img id="goodLogo" style="width:70px;height:70px;" src="${sessionScope.image_logo}${goodsInfo.logo}" />
											</c:if>
										</div>
										<div style="float:left;margin-left:17px;margin-top:13px;">
											<div style="font-size: 14px;">${goodsInfo.name}</div>
											<div style="margin-top:7px;font-size: 12px;">销量：x${goodsInfo.sales}件</div>
										</div>
									</div>
									<div style="margin-top: 9px;">
										<hr style="border: 1px dashed #E6E6E6;width: 100%;margin:0 auto;margin-top:78px;">
									</div>
								</div>
							</c:forEach>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	var ctx = '${ctx}';
	setCtx(ctx);
	
	
	/* $("#main").css('width','102%'); */
	$("#main").css('margin-left','');
	
	/**
	 * 小区通知详情
	 */
	function showDetail(id){
		msg = "小区通知";
		url = ctx + "/noticeInfo/noticeInfoDetail?id=" + id +"&type=1";
		index = layer.open({
		      type: 2,
		      //skin: 'layui-layer-lan',
		      title: msg,
		      fix: false,
		      shadeClose: true,
		      scrollbar: false,
		      maxmin: false,
		      edit: true,
		      closeBtn: 1,
		      area: ['620px', '412px'],
		      content: url
			});
		
	}
</script>

<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>

</html>
